package com.csdj.controller;


import com.csdj.entity.User;
import com.csdj.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.csdj.entity.User;
import com.csdj.service.IUserService;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zq
 * @since 2024-12-11
 */
@RestController
@Slf4j
@RequestMapping("/user")
@CrossOrigin
public class UserController {
    @Autowired
    private IUserService userService;

    @PostMapping("/addUser")
    public Object addUser( User user){
        int i = userService.addUser(user);
        return i;

    }


    @GetMapping("login")
    public int login(@RequestParam String uname,@RequestParam String password) {
        int result = userService.getUser(uname,password);
        return result;
    }
}
